package com.zhenwei.zscm.model.enums;

import lombok.Getter;

@Getter
public enum RoleEnum {
    ADMIN("管理员"),
    USER("普通用户"),
    ENGINEER("工程师"),
    BUSINESS("商务");
    final String text;

    RoleEnum(String text) {
        this.text = text;
    }

    /**
     * 转换为角色
     *
     * @param str 枚举值，不在枚举返回普通角色
     * @return RoleEnum
     */
    public static RoleEnum valOf(String str) {
        try {
            return RoleEnum.valueOf(str);
        } catch (Exception e) {
            return RoleEnum.USER;
        }
    }
}
